{% extends "base.html" %}

{% block title %}Informations de l'utilisateur{% endblock %}
{% block content_title %}Informations de l'utilisateur{% endblock %}
{% block image %}<img src="/media/images/oxygen/kontact.png" />{% endblock %}

{% block content %}

<fieldset class="block form">
    <legend>Mes paramètres</legend>
    <ul>
        <li><a href="{% url django.contrib.auth.views.password_change %}">Changement de mot de passe</a></li>
        <li>Modification des informations personnelles</li>
        <li>Suppression de compte</li>
        <li>Clef clariupdateur {{ client }} (<span style="color:red;">authkey</span>): 
        {% if packageauth %}<b>{{ packageauth.key }}</b>{% else %}<b>Non disponible.</b>{% endif %}
        </li>
        {% if chuserform %}<li>
        <form action="{% url chuser_change_user %}" method="post">{% csrf_token %}
          <div><button dojoType="dijit.form.Button" type="submit">Changer d'utilisateur</button><span>{{ chuserform.user }}</span></div>
        </form>
        </li>{% endif %}
        {% if perms.clariadmin.can_access_clariadmin %}<li>Niveau de sécurité appliqué: {{ user.security_level }}</li>{% endif %}
    </ul>
</fieldset>

{% if bondecommandes %}
<fieldset class="block form">
    <legend>Mes bons de commande</legend>
    <table class="exportable resultat">
        <thead>
            <tr>
                <th>N°</th>
                <th>Date</th>
                <th>Client</th>
                <th>Ticket</th>
                <th>Commentaire</th>
                <th>Fichiers</th>
            </tr>
        </thead>
        <tbody>
        {% for bdc in bondecommandes %}
            <tr class="bigrow {% cycle 'row1' 'row2' %}">
                <td style="font-size: 1.4em; font-weight: bold;">{{ bdc.id }}</td>
                <td style="font-size: 1.2em;">{{ bdc.date_creation }}</td>
                <td>{{ bdc.client }}</td>
                <td{% if bdc.is_closed %} style="text-decoration: line-through"{% endif %}>
                    {% if bdc.ticket %}<a href="{% url ticket_modify bdc.ticket.id %}">{{ bdc.ticket.id }}</a>{% else %}Aucun ticket{% endif %}
                </td>
                <td>{{ bdc.comment }}</td>
                <td>{% if bdc.bondecommandefile_set.all %}{% for f in bdc.bondecommandefile_set.all %}{{ f }} {% endfor %}{% else %}Aucun fichier{% endif %}</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
</fieldset>
{% endif %}

<fieldset class="block form">
    <legend>Mes laboratoires</legend>
    <ul>{% for client in clients %}
        <li><a href="/common/client/modify/{{ client.id }}/">{{ client }}</a></li>
    {% endfor %}
    </ul>
</fieldset>

{% endblock %}
